﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLTV_Public;
using QLTV_BLL;

namespace GUI
{
    public partial class frmGiaHanThe : DevExpress.XtraEditors.XtraForm
    {
        #region khai bao bien
        DocGia_BLL dg_bll = new DocGia_BLL();
        TextMessageBox box = new TextMessageBox();
        public string maDocGia = "";
        #endregion

        #region LoadForm

        public frmGiaHanThe()
        {
            InitializeComponent();
        }

        private void frmGiaHanThe_Load(object sender, EventArgs e)
        {
            txtMaDocGia.Text = maDocGia;
        }

        #endregion

        #region Cac chuc nang

        private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DocGia_Public dg_public = new DocGia_Public();
            string[] s_maDocGia = maDocGia.Split(',');
            int length = s_maDocGia.Length - 1;
            for (int i = 0; i < s_maDocGia.Length-1; i++)
            {
                dg_public.MaDocGia = s_maDocGia[i];
                dg_public.NgayHetHan = dtpNgayHetHan.Value;

                dg_bll.Update_GiaHanThe(dg_public);
            }
            XtraMessageBox.Show("Gia hạn thẻ thành công cho: '"+length.ToString()+"'");
            DialogResult = DialogResult.OK;
        }

        private void btnThoat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }

        #endregion
    }
}